//
//  MGTabPageBar.h
//  Mango
//
//  Created by 胡超 on 2020/6/29.
//  Copyright © 2020 HuChao. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MGTabIndicatorView.h"
#import "MGTabPageBarStyle.h"

NS_ASSUME_NONNULL_BEGIN

@class MGTabPageBar;

@protocol MGTabPageBarDelegate <UIScrollViewDelegate>
- (void)tabPageBar:(MGTabPageBar *)tabPageBar didSelectItemAtIndex:(NSInteger)atIndex;
@end

@interface MGTabPageBar : UIView

@property (nonatomic,strong,nullable) NSArray <NSString *> *items;
@property (nonatomic,assign) NSInteger selectedItemIndex;

@property (nonatomic,weak) id<MGTabPageBarDelegate> delegate;

@property (nonatomic,readonly) MGTabPageBarStyle *style;
@property (nonatomic,readonly) NSArray<UIButton *> *extraItems;

- (instancetype)initWithFrame:(CGRect)frame;
- (instancetype)initWithFrame:(CGRect)frame style:(nullable MGTabPageBarStyle *)style;
- (void)setSelectedItemIndex:(NSInteger)selectedItemIndex animated:(BOOL)animated;

- (void)setExtraItemSize:(CGSize)itemSize space:(CGFloat)space;
- (void)addExtraItem:(UIImage *)image target:(id)target selector:(SEL)selector;
- (void)addExtraItem:(UIImage *)image size:(CGSize)size target:(id)target selector:(SEL)selector;

@end

NS_ASSUME_NONNULL_END
